package org.apache.click.doubleclick.samples.clickspring.pages;

import org.apache.click.control.ActionLink;
import org.apache.click.doubleclick.inject.annotation.InjectBean;
import org.apache.click.doubleclick.samples.clickspring.greetingsservice.IGreetingsService;
import org.apache.click.util.Bindable;

public class HomePage extends BorderPage {
    @InjectBean
    private IGreetingsService greetingsService;

    @Bindable
    private String title = "Home";

    @Bindable
    protected ActionLink myLink1 = new ActionLink(this, "onLinkClick1");

    @Bindable
    protected ActionLink myLink2 = new ActionLink(this, "onLinkClick2");

    @Bindable
    protected String msg1;

    @Bindable
    protected String msg2;

    public boolean onLinkClick1() {
        msg1 = greetingsService.sayHello("Click");
        return true;
    }

    public boolean onLinkClick2() {
        msg2 = new AccessInjectAware().sayGreetings("DoubleClick");
        return true;
    }
}